<?php
$start_time=microtime(true);
require_once ROOT.'/core/modules/content/class.content.php';
$content=new content_class();
$sql="SELECT * FROM ".DB_PREFIX."content_article WHERE article_is_display=1 AND article_title like '%".$this->keyword."%'  ORDER BY article_id DESC";
$page_size=$this->config['content_front_search_size'];
$page_current=isset($_GET['page'])&&is_numeric($_GET['page'])?intval($_GET['page']):1;
$count=$this->db->count($sql);
$page_count=ceil($count/$page_size);
$result=$this->db->result($sql." LIMIT ".(($page_current-1)*$page_size).",".$page_size);
$array=array();
if($count>0){
	foreach($result as $row){
		$array[$row['article_id']]['id']=$row['article_id'];
		$array[$row['article_id']]['title']=$row['article_title'];
		$array[$row['article_id']]['content']=substr(strip_tags($row['article_content']),0 ,320) . '...';
		$array[$row['article_id']]['author']=$row['article_author'];
		$array[$row['article_id']]['image']=$row['article_image'];
		$array[$row['article_id']]['uri']=PATH.HTML_DIR.$content->category_parent_path($row['category_id'])."/".$row['article_html'].".html";
		$array[$row['article_id']]['time']=date("Y.m.d",$row['article_time']);
		$array[$row['article_id']]['comment_count']=$row['article_comment_count'];
		$array[$row['article_id']]['click_count']=$row['article_click_count'];
		$array[$row['article_id']]['category_name']=$this->db->value(DB_PREFIX."content_category","category_name","category_id=".$row['category_id']);
		$array[$row['article_id']]['category_id']=$row['category_id'];
	}
	$pagebar=pager($_SERVER['REQUEST_URI'],'',$page_current,$page_size,$count);
}
$end_time=microtime(true);
$time=$end_time-$start_time;
$this->template->in('article_list',$array);
$this->template->in('pager',$pagebar);
$this->template->in('time',$time);
$this->template->out('content.search.php');

